package com.ruoyi.biz.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.ruoyi.biz.domain.dto.CaculateGoodsDto;
import com.ruoyi.biz.domain.vo.CaculateGoodsVo;
import com.ruoyi.biz.strategy.manager.GoodsCategoryManager;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.biz.mapper.BizGoodsCategoryMapper;
import com.ruoyi.biz.domain.BizGoodsCategory;
import com.ruoyi.biz.service.IBizGoodsCategoryService;

/**
 * 商品类别信息Service业务层处理
 * 
 * @author tds
 * @date 2022-11-10
 */
@Service
public class BizGoodsCategoryServiceImpl implements IBizGoodsCategoryService 
{
    @Autowired
    private BizGoodsCategoryMapper bizGoodsCategoryMapper;

    @Autowired
    private GoodsCategoryManager goodsCategoryManager;

    /**
     * 查询商品类别信息
     * 
     * @param goodsId 商品类别信息主键
     * @return 商品类别信息
     */
    @Override
    public BizGoodsCategory selectBizGoodsCategoryByGoodsId(Long goodsId)
    {
        return bizGoodsCategoryMapper.selectBizGoodsCategoryByGoodsId(goodsId);
    }

    /**
     * 查询商品类别信息列表
     * 
     * @param bizGoodsCategory 商品类别信息
     * @return 商品类别信息
     */
    @Override
    public List<BizGoodsCategory> selectBizGoodsCategoryList(BizGoodsCategory bizGoodsCategory)
    {
        return bizGoodsCategoryMapper.selectBizGoodsCategoryList(bizGoodsCategory);
    }

    /**
     * 新增商品类别信息
     * 
     * @param bizGoodsCategory 商品类别信息
     * @return 结果
     */
    @Override
    public int insertBizGoodsCategory(BizGoodsCategory bizGoodsCategory)
    {
        bizGoodsCategory.setCreateTime(DateUtils.getNowDate());
        return bizGoodsCategoryMapper.insertBizGoodsCategory(bizGoodsCategory);
    }

    /**
     * 修改商品类别信息
     * 
     * @param bizGoodsCategory 商品类别信息
     * @return 结果
     */
    @Override
    public int updateBizGoodsCategory(BizGoodsCategory bizGoodsCategory)
    {
        bizGoodsCategory.setUpdateTime(DateUtils.getNowDate());
        return bizGoodsCategoryMapper.updateBizGoodsCategory(bizGoodsCategory);
    }

    /**
     * 批量删除商品类别信息
     * 
     * @param goodsIds 需要删除的商品类别信息主键
     * @return 结果
     */
    @Override
    public int deleteBizGoodsCategoryByGoodsIds(Long[] goodsIds)
    {
        return bizGoodsCategoryMapper.deleteBizGoodsCategoryByGoodsIds(goodsIds);
    }

    /**
     * 删除商品类别信息信息
     * 
     * @param goodsId 商品类别信息主键
     * @return 结果
     */
    @Override
    public int deleteBizGoodsCategoryByGoodsId(Long goodsId)
    {
        return bizGoodsCategoryMapper.deleteBizGoodsCategoryByGoodsId(goodsId);
    }

    /**
     * 计算商品类别价格
     *
     * @param caculateGoodsDto 商品类别计算信息
     * @return
     */
    @Override
    public CaculateGoodsVo caculate(CaculateGoodsDto caculateGoodsDto) {
        return goodsCategoryManager.caculate(caculateGoodsDto);
    }
}
